package yl.hs.bmipfull.controllers.finance;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yl.hs.bmipfull.controllers.ControllerBase;
import yl.hs.bmipfull.service.finance.IShipLedgerService;
import yl.hs.bmipfull.service.system.ISearchViewService;
import yl.hs.bmipfull.viewmodels.PageQuery;
import yl.hs.bmipfull.viewmodels.WebResult;

/*
 * ShipLedgerController 发发货收款台账控制器
 * @category 财务管理——发货收款台账
 * @author 谢景广
 * @date 2022-01-10
 */
@Api(value = "发货结算操作数据接口", tags = "财务管理——发货收款台账")
@RequestMapping(path = "/api/finance/shipLedger")
@RestController
public class ShipLedgerController extends ControllerBase {

    @ApiOperation(value = "发货台账查询数据接口", notes = "查询发货台账")
    @RequestMapping(path="/{rowNum}/{page}",method = RequestMethod.POST)
    public WebResult queryShipLedger(@RequestBody PageQuery query, @ApiParam("页面大小") @PathVariable int rowNum, @ApiParam("页码") @PathVariable int page){
        try {
            var result = slSvc.queryShipLedger(query,rowNum,page);
            svSVC.updateUserMenuView(query);
            return success("ok",result);
        }
        catch (Exception ee)
        {
            return error(ee);
        }
    }

    @Autowired
    public void setSvSVC(ISearchViewService svSVC) {
        this.svSVC = svSVC;
    }

    @Autowired
    public void setSlSvc(IShipLedgerService slSvc) {
        this.slSvc = slSvc;
    }

    IShipLedgerService slSvc;
    ISearchViewService svSVC;
}
